<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    组件1
    <input type="radio" value="CommonHead1" v-model="isWho">
    组件2
    <input type="radio" value="CommonHead2" v-model="isWho">
    组件3
    <input type="radio" value="CommonHead3" v-model="isWho">
    <component :is="isWho"></component>
  </div>
  <script src="./vue.js"></script>
  <script>
    const CommonHead1 = {
      template: `
        <div>
          <h2>组件1</h2>  
        </div>
      `
    }
    const CommonHead2 = {
      template: `
        <div>
          <h2>组件2</h2>  
        </div>
      `
    }
    const CommonHead3 = {
      template: `
        <div>
          <h2>组件3</h2>  
        </div>
      `
    }
    Vue.component('CommonHead1', CommonHead1)
    Vue.component('CommonHead2', CommonHead2)
    Vue.component('CommonHead3', CommonHead3)
    const vm = new Vue({
      el: '#app',
      data: {
        isWho: 'CommonHead1'
      }
    })
  </script>
</body>
</html>